package utility;

import java.nio.FloatBuffer;

import com.jme.scene.TexCoords;
import com.jme.scene.shape.Box;
import com.jme.scene.state.TextureState;
import com.jme.util.geom.BufferUtils;

/**
 * 
 * @author Massimiliano
 * imposta la texture all'oggetto
 * si passa al costruttore la TextureState delle
 * texture che si vuole applicare
 *
 */
public class TexturedMesh {
	private static final long serialVersionUID = 1L;
	
	public static void Textured(Box box, TextureState rs)
	{
		box.setRenderState(rs);
		
		FloatBuffer tex1 = BufferUtils.createVector2Buffer(4);
		for(int x=0;x<4;x++)
			tex1.put(1.0f).put(0.0f);
		box.setTextureCoords(new TexCoords(tex1),1); 
		
		FloatBuffer tex2 = BufferUtils.createVector2Buffer(4);
		for(int x=0;x<4;x++)
			tex2.put(0.0f).put(1.0f);
		box.setTextureCoords(new TexCoords(tex2), 2);
	}
}
